package com.qf.boot2202.controller;

import com.qf.boot2202.service.HelloService;
import com.qf.boot2202.service.impl.HelloServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/hello")
public class HelloController {

    @Value("${mycar.brand}")
    private String brand;

//    @Value("${k}")
//    private String[] k;

    @Autowired
    @Qualifier("myhelloService")
    private HelloService helloService;

    @GetMapping("/test1")
    public String hello(HttpServletRequest req){

        System.out.println(req.getServletContext().getRealPath("/"));

        System.out.println(brand);

//        for (String s : k) {
//            System.out.println(s);
//        }

        return helloService.helloboot();
    }

}
